//
//  HotproductViewController.m
//  SDHuiYuShoping
//
//  Created by luojiao on 2017/4/24.
//  Copyright © 2017年 luojiao. All rights reserved.
//

#import "HotproductViewController.h"
#import "HotCollectionViewCell.h"

@interface HotproductViewController ()

@end

@implementation HotproductViewController

static NSString * const reuseIdentifier = @"collectionCell";

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.hidden = YES;
    self.searchTextField.delegate = self;
    [self setBgImage];
    //隐藏滚动条
    self.collectionView.showsVerticalScrollIndicator = FALSE;
    self.collectionView.showsHorizontalScrollIndicator = FALSE;

    
    //注册cell
    [self.collectionView registerNib:[UINib nibWithNibName:@"HotCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:reuseIdentifier];
    
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    //设置状态栏颜色
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
}

- (void)setBgImage
{
    //设置返回按钮
    [self.backButton setImage:[UIImage imageNamed:@"back_white_btn"] forState:UIControlStateNormal];
    [self.backButton setImageEdgeInsets:UIEdgeInsetsMake(0, -50, 0, 0)];
    [self.backButton setTitle:@"返回" forState:UIControlStateNormal];
    [self.backButton setTitleEdgeInsets:UIEdgeInsetsMake(0, -40, 0, 0)];
    // set search view
    [self.searchImage setImage:[UIImage imageNamed:@"found_btn"]];
    [self.searchBGImage setImage:[FRUtils resizeImageWithImageName:@"search_bg"]];
    [self.searchButton setTitle:@"搜 索" forState:UIControlStateNormal];
    [self.searchButton setTitleEdgeInsets:UIEdgeInsetsMake(0, -20, 0, 0)];
    [self.searchButton.titleLabel setFont:[UIFont systemFontOfSize:15]];
    
    [self.timeButton setTitle:@"上架时间" forState:UIControlStateNormal];
    [self.timeButton setTitleEdgeInsets:UIEdgeInsetsMake(-10, 0, 0, 0)];
    
    [self.salesButton setTitle:@"销量" forState:UIControlStateNormal];
    [self.salesButton setTitleEdgeInsets:UIEdgeInsetsMake(-10, 0, 0, 0)];
    
    [self.priceButton setTitle:@"价格" forState:UIControlStateNormal];
    [self.priceButton setTitleEdgeInsets:UIEdgeInsetsMake(-10, 0, 0, 0)];
}

- (IBAction)backButton:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (IBAction)searchButton:(id)sender
{
}

#pragma mark - UITextFieldDelegate

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    return YES;
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self.view endEditing:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - UICollectionViewDelegate,UICollectionViewDataSource

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return 8;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    HotCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
    cell.productImage.image = [UIImage imageNamed:@"test2"];
    return cell;
}






/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
